/*
 * Copyright (c) 2024. Shanghai HEADING information Engineering Co., Ltd. All rights reserved.
 */
package com.lovely602.design.study.proxy.jdk;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author lizhixing
 */
public class JdkInvocationHandler implements InvocationHandler {

  private final Object target;

  public JdkInvocationHandler(Object target) {
    this.target = target;
  }

  @Override
  public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

    System.out.println("Before method call");
    Object result = method.invoke(target, args);
    System.out.println("After method call");
    return result;
  }
}
